package spring.demo.security;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;

@SpringBootApplication
public class SecurityApplication {

	public static void main(String[] args) {

		ApplicationContext context = SpringApplication.run(SecurityApplication.class, args);
	/*	Util.setApplicationContext(context);
		UserRepository userRepository = Util.getBean(UserRepository.class);
		List<SysUser> sysUserList = userRepository.findAll();

		sysUserList.stream().forEach(sysUser -> {
			sysUser.setPassword("$2a$04$8I6tInXsrjqq4sTe8ZMsJe15WcYLwRZQo3D0ZWsr/o77UjnPF/nsO");
			userRepository.save(sysUser);

		});*/
		/*SysUser sysUser = userRepository.findByName("zhangsan");
		BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder(4);
		System.out.println("之前:" +sysUser.getPassword());
		sysUser.setPassword(bCryptPasswordEncoder.encode(sysUser.getPassword()));
		System.out.println("之后:"+ sysUser.getPassword());
		userRepository.save(sysUser);*/
		//userRepository.findByName()

	}


}
